Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <head> <style> div { width: 100px; height: 100px; background: red; position: relative; -webkit-animation: mymove 2s 1; /* Chrome, Safari, Opera */ animation: mymove 2s 2; } /* Chrome, Safari, Opera */ @-webkit-keyframes mymove { from {left: 0px;} to {left: 200px;} } @keyframes mymove { from {left: 0px;} to {left: 200px;} } </style> </head> <body> <p>Click the "Try it" button to let the DIV element keep the styles set by the last keyframe: to {left:200px;}, when the animation is finished.</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { document.getElementById("myDIV").style.WebkitAnimationFillMode = "forwards"; // Code for Chrome, Safari, and Opera document.getElementById("myDIV").style.animationFillMode = "forwards"; } </script> <p><strong>Note:</strong> For Firefox users: be sure to click the button before the animation has finished, if not the change will not have any affect because the animation will not start over once it has finished.</p> <p><strong>Note:</strong> The animationFillMode property is only supported in Firefox.</p> <div id="myDIV"></div> </body> <!-- Mirrored from www.w3schools.com/cssref/tryit.asp?filename=trycss3_js_animation-fill-mode by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 07:50:00 GMT --> </html>
Result:
Try it Yourself - © w3schools.com